#include "CH58x_common.h"
#include "string.h"
#include "DevicesLed.h"


void vLedInit(void)
{
    vLedOpen(LED_CHANNEL_ALL);

    GPIOB_ModeCfg(LED_1_Pin, GPIO_ModeOut_PP_5mA);
    GPIOB_ModeCfg(LED_2_Pin, GPIO_ModeOut_PP_5mA);
}

void vLedOpen(uint32_t uiChannel)
{
    if(uiChannel & LED_CHANNEL_1)
    {
        GPIOB_ResetBits(LED_1_Pin);
    }
    if(uiChannel & LED_CHANNEL_2)
    {
        GPIOB_ResetBits(LED_2_Pin);
    }
}

void vLedClose(uint32_t uiChannel)
{
    if(uiChannel & LED_CHANNEL_1)
    {
        GPIOB_SetBits(LED_1_Pin);
    }
    if(uiChannel & LED_CHANNEL_2)
    {
        GPIOB_SetBits(LED_2_Pin);
    }
}

void vLedRevesal(uint32_t uiChannel)
{
    if(uiChannel & LED_CHANNEL_1)
    {
        GPIOB_InverseBits(LED_1_Pin);
    }
    if(uiChannel & LED_CHANNEL_2)
    {
        GPIOB_InverseBits(LED_2_Pin);
    }
}
